<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function fn(i) {
            return function(n) {
                console.log(n + (i++));
            }
        }
        var f = fn(10); // i = 10
        f(20); //输出 30 i = 11
        fn(20)(40); // 输出60 i = 21
        fn(30)(50); //输出 80 i = 31
        f(30); //输出 41 i = 12
    </script>
</body>

</html>